﻿<Application x:Class="yaTDL.App"
             
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    
    StartupUri="MainWindow.xaml"
    ShutdownMode="OnMainWindowClose"
    DispatcherUnhandledException="Application_DispatcherUnhandledException"
    Exit="Application_Exit" >       
    
	<Application.Resources>
		<!-- Resources scoped at the Application level should be defined here. -->
		
        <!--Dialog Window Style-->        
		<Style x:Key="DialogWindowSytle" TargetType="{x:Type Window}">
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
			<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Window}">
						<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
							<Grid Margin="0">
								<AdornerDecorator Margin="0,40,0,0">
									<ContentPresenter/>
								</AdornerDecorator>
								<Label HorizontalAlignment="Stretch" Content="{TemplateBinding Title}" VerticalAlignment="Top" Height="40" FontSize="24" Padding="8,0,0,0" 
									VerticalContentAlignment="Center" FontFamily="Segoe UI Light" />
							</Grid>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>			
			<Style.Triggers>
				<Trigger Property="ResizeMode" Value="CanResizeWithGrip">					
					<Setter Property="Template">
						<Setter.Value>
							<ControlTemplate TargetType="{x:Type Window}">
								<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
									<Grid>
										<AdornerDecorator>
											<ContentPresenter/>
										</AdornerDecorator>
										<ResizeGrip x:Name="WindowResizeGrip" HorizontalAlignment="Right" IsTabStop="false" Visibility="Collapsed" VerticalAlignment="Bottom"/>
									</Grid>	
								</Border>
								<ControlTemplate.Triggers>
									<MultiTrigger>
										<MultiTrigger.Conditions>
											<Condition Property="ResizeMode" Value="CanResizeWithGrip"/>
											<Condition Property="WindowState" Value="Normal"/>
										</MultiTrigger.Conditions>
										<Setter Property="Visibility" TargetName="WindowResizeGrip" Value="Visible"/>
									</MultiTrigger>
								</ControlTemplate.Triggers>
							</ControlTemplate>
						</Setter.Value>
					</Setter>
				</Trigger>
			</Style.Triggers>
			
		</Style>       
        
		<!---->
        <!--Color Resources-->
		<!---->
		
        <!--Solid Colors in the task-list-->    
        <SolidColorBrush x:Key="TaskList_Red" Color="#FFDA0000"/>
        <SolidColorBrush x:Key="TaskList_Yellow" Color="Orange" />
        <SolidColorBrush x:Key="TaskList_Green" Color="#FF9BC800" />
        <SolidColorBrush x:Key="TaskList_Blue" Color="#FF1868B8" />

        
        <!--Gradient in the task-list-->
        <!--<LinearGradientBrush x:Key="TaskList_Red" EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FFFF8888" Offset="0"/>
            <GradientStop Color="#FFDA0000" Offset="1"/>
        </LinearGradientBrush>-->

        <!--<LinearGradientBrush x:Key="TaskList_Yellow" EndPoint="0.5,1" StartPoint="0.5,0">
        	<GradientStop Color="#FFFFD079" Offset="0"/>
        	<GradientStop Color="Orange" Offset="1"/>
        </LinearGradientBrush>-->

        <!--<LinearGradientBrush x:Key="TaskList_Green" EndPoint="0.5,1" StartPoint="0.5,0">
        	<GradientStop Color="#FF9BC800" Offset="1"/>
        	<GradientStop Color="#FFF5F9B0"/>
        </LinearGradientBrush>

        <LinearGradientBrush x:Key="TaskList_Blue" EndPoint="0.5,1" StartPoint="0.5,0">
        	<GradientStop Color="#FF1868B8" Offset="1"/>
        	<GradientStop Color="#FF90B0D0"/>
        </LinearGradientBrush>-->


        <SolidColorBrush x:Key="MetroButton_DisabledColor" Color="#FFD6D6D6" />
        <SolidColorBrush x:Key="MetroButton_DefaultColor" Color="#FF858585" />
        <SolidColorBrush x:Key="MetroButton_MouseOverColor" Color="#FF333333" />
        <SolidColorBrush x:Key="MetroButton_IsPressedColor" Color="#FFADADAD" />

        <SolidColorBrush x:Key="Settings_Foreground" Color="Black" />
        <SolidColorBrush x:Key="Settings_Background" Color="White" />

        <SolidColorBrush x:Key="Pivot_Default" Color="Gray" />
        <SolidColorBrush x:Key="Pivot_IsSelected" Color="Black" />
        <SolidColorBrush x:Key="Pivot_IsMouseOver" Color="LightGray" />

        <SolidColorBrush x:Key="Application_BorderBrush" Color="LightGray" />

        <!--Horizontal ListBox-->
        <Style x:Key="ListBoxStyle_Horizontal" TargetType="{x:Type ListBox}">
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!--Item Style for Pivotcontrol-like Horizontal ListBox-->
        <Style x:Key="ListBoxItemStyle_Pivot" TargetType="{x:Type ListBoxItem}">            
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="FontFamily" Value="Segoe WP"/>
            <Setter Property="Foreground" Value="{StaticResource Pivot_Default}"/>
            <Setter Property="VerticalContentAlignment" Value="Top"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <Border Name="Border" Padding="2" SnapsToDevicePixels="true">
                            <ContentPresenter />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter Property="FontWeight" Value="Bold"/>
                                <Setter Property="Foreground" Value="{StaticResource Pivot_IsSelected}"/>
                            </Trigger>

                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsMouseOver" Value="True"/>
                                    <Condition Property="Selector.IsSelected" Value="False"/>
                                </MultiTrigger.Conditions>
                                <Setter Property="Foreground" Value="{StaticResource Pivot_IsMouseOver}"/>
                            </MultiTrigger>

                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="#888888"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            
        </Style>


        <!--ListBoxItemStyle used in the Settings Page -->
        <Style x:Key="ListBoxItemStyle_SettingsSelector" TargetType="{x:Type ListBoxItem}">
            <Setter Property="SnapsToDevicePixels" Value="true"/>
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="FontWeight" Value="Bold"/>

            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <Border Name="Border" Padding="2" SnapsToDevicePixels="true">
                            <Grid>
                                <Viewbox Name="Viewbox"  Visibility="Collapsed" Margin="2,0,0,0" Stretch="Fill" Height="10" Width="5"
                                         HorizontalAlignment="Left" VerticalAlignment="Center" >
                                    <Polygon Fill="Black"  Points="0 0, 20 20, 0 40"/>
                                </Viewbox>
                                <ContentPresenter Margin="10,0,0,0" VerticalAlignment="Center" />
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter TargetName="Viewbox" Property="Visibility" Value="Visible"/>                                
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="#888888"/>
                            </Trigger>

                            <Trigger Property="IsMouseOver" Value="true">
                                <Setter Property="Foreground" Value="LightGray"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>


        <!--zune-ish/metro ListBoxItemStyle-->
        <Style x:Key="ListBoxItemStyle_Metro" TargetType="{x:Type ListBoxItem}">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="Padding" Value="2,0,0,0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsMouseOver" Value="True"/>
                                    <Condition Property="Selector.IsSelected" Value="False"/>
                                </MultiTrigger.Conditions>
                                <Setter Property="Background" TargetName="Bd" Value="#FFE7E8E8"/>
                            </MultiTrigger>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter Property="Background" TargetName="Bd" Value="#FFD8D8D9"/>
                                <Setter Property="FontWeight" Value="Normal"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>


        <Style x:Key="ListBoxItemStyle_NoBackground" TargetType="{x:Type ListBoxItem}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="Padding" Value="2,0,0,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="true">                            
                            <Setter Property="FontWeight" Value="Normal"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        </Style>
        
        
        <!--metro ButtonStyle-->
        <Style x:Key="ButtonStyle_Metro" TargetType="{x:Type Button}">
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="FontFamily" Value="Segoe WP"/>           
            <Setter Property="Background" Value="{x:Null}"/>
            <Setter Property="BorderBrush" Value="{x:Null}"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Foreground" Value="{DynamicResource MetroButton_DefaultColor}"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Padding" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid x:Name="grid" HorizontalAlignment="Stretch" Background="#00010101">
                            <ContentPresenter RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Center" VerticalAlignment="Center"/>                            
                        </Grid>
                        <ControlTemplate.Triggers>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsMouseOver" Value="True"/>
                                    <Condition Property="IsPressed" Value="False"/>
                                </MultiTrigger.Conditions>
                                <Setter Property="Background" Value="{x:Null}"/>
                                <Setter Property="BorderBrush" Value="{x:Null}"/>
                                <Setter Property="Foreground" Value="{DynamicResource MetroButton_MouseOverColor}"/>
                            </MultiTrigger>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter Property="Background" Value="{x:Null}"/>
                                <Setter Property="BorderBrush" Value="{x:Null}"/>
                                <Setter Property="Foreground" Value="{DynamicResource MetroButton_DisabledColor}"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="Background" Value="{x:Null}"/>
                                <Setter Property="BorderBrush" Value="{x:Null}"/>
                                <Setter Property="Foreground" Value="{DynamicResource MetroButton_IsPressedColor}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!--Headerless TabControl-->
        <Style x:Key="HeaderlessTabControl" TargetType="{x:Type TabControl}">
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="Padding" Value="4,4,4,4"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="BorderBrush" Value="Transparent"/>
            <Setter Property="Background" Value="#F9F9F9"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabControl}">
                        <Grid ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition x:Name="ColumnDefinition0"/>
                                <ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
                                <RowDefinition x:Name="RowDefinition1" Height="*"/>
                            </Grid.RowDefinitions>
                            <Border x:Name="ContentPanel" BorderThickness="{TemplateBinding BorderThickness}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
                                <ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="TabStripPlacement" Value="Bottom">
                                <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                                <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                                <Setter Property="Height" TargetName="RowDefinition1" Value="Auto"/>
                            </Trigger>
                            <Trigger Property="TabStripPlacement" Value="Left">
                                <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                                <Setter Property="Grid.Column" TargetName="ContentPanel" Value="1"/>
                                <Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto"/>
                                <Setter Property="Width" TargetName="ColumnDefinition1" Value="*"/>
                                <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                                <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
                            </Trigger>
                            <Trigger Property="TabStripPlacement" Value="Right">
                                <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                                <Setter Property="Grid.Column" TargetName="ContentPanel" Value="0"/>
                                <Setter Property="Width" TargetName="ColumnDefinition0" Value="*"/>
                                <Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto"/>
                                <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                                <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <SolidColorBrush x:Key="TabControlNormalBorderBrush" Color="#8C8E94"/>
                       
    </Application.Resources>
</Application>